package com.evil.application.api;

import com.evil.application.config.FeignErrorDecoder;
import com.evil.application.pojo.dto.form.control.ControlBaseInfoDTO;
import com.evil.application.pojo.dto.reporting.*;
import com.evil.common.core.constant.ServiceNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;

/**
 * 应用报表接口
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@FeignClient(name = ServiceNameConstant.APPLICATION_SERVICE, configuration = {FeignErrorDecoder.class})
public interface RemoteApplicationReportingService {

    /**
     * 报表枚举
     *
     * @param applicationKey applicationKey
     * @return Map
     */
    @PostMapping("/remote/application/reporting/types")
    Map<String, List<?>> types(@RequestParam("applicationKey") @NotBlank(message = "应用key不能为空") String applicationKey);

    /**
     * 应用报表基础信息列表
     *
     * @param appReportingBasesReqDTO appReportingBasesReqDTO
     * @return List
     */
    @PostMapping("/remote/application/reporting/bases")
    List<ApplicationReportingBaseDTO> appReportingBases(@Validated @RequestBody AppReportingBasesReqDTO appReportingBasesReqDTO);

    /**
     * 应用报表基础信息
     *
     * @param reportingKey reportingKey
     * @return ApplicationReportingRespDTO
     */
    @PostMapping("/remote/application/reporting/base-info")
    ApplicationReportingBaseDTO appReportingBaseInfo(@RequestParam("reportingKey") @NotBlank(message = "报表key不能为空") String reportingKey);

    /**
     * 应用报表信息
     *
     * @param reportingKey reportingKey
     * @return ApplicationReportingRespDTO
     */
    @PostMapping("/remote/application/reporting/info")
    ApplicationReportingDTO appReportingInfo(@RequestParam("reportingKey") @NotBlank(message = "报表key不能为空") String reportingKey);

    /**
     * 新增应用报表
     *
     * @param addReportingReqDTO addReportingReqDTO
     * @return AddReportingRespDTO
     */
    @PostMapping("/remote/application/reporting/add")
    AddReportingRespDTO addReporting(@Validated @RequestBody AddReportingReqDTO addReportingReqDTO);

    /**
     * 复制应用报表
     *
     * @param reportingKey reportingKey
     * @return AddReportingRespDTO
     */
    @PostMapping("/remote/application/reporting/copy")
    AddReportingRespDTO copyReporting(@RequestParam("reportingKey") @NotBlank(message = "报表key不能为空") String reportingKey);

    /**
     * 删除应用报表
     *
     * @param reportingKey reportingKey
     */
    @PostMapping("/remote/application/reporting/delete")
    void deleteReporting(@RequestParam("reportingKey") @NotBlank(message = "报表key不能为空") String reportingKey);

    /**
     * 编辑应用报表权限
     *
     * @param modifyReportingPermissionReqDTO modifyReportingPermissionReqDTO
     */
    @PostMapping("/remote/application/reporting/permission/modify")
    void modifyReportingPermission(@Validated @RequestBody ModifyReportingPermissionReqDTO modifyReportingPermissionReqDTO);

    /**
     * 编辑应用报表
     *
     * @param applicationReportingDTO applicationReportingDTO
     */
    @PostMapping("/remote/application/reporting/modify")
    ApplicationReportingBaseDTO modifyReporting(@Validated @RequestBody ApplicationReportingDTO applicationReportingDTO);
}
